package com.foreveross.crawl.group;



/**
 * 任务组对象
 * @author guokenye
 *
 */
public class TaskGroup {/*

	private String groupName;
	private long startTime;//任务组开启的时间
	private long timeout;//任务组超时时间
	private String from;
	private String to;
	private String flightDate;
	private BlockingQueue<GradChannelEntity> channels;
	
	
	protected TaskGroup(String groupName,
			String from, String to, String flightDate,long timeout) {
		super();
		this.groupName = groupName;
		this.startTime = -1;
		this.timeout = timeout;
		this.from = from;
		this.to = to;
		this.flightDate = flightDate;
	}

	@Override
	public boolean equals(Object other) {
		if(this == other){                                      //先检查是否其自反性，后比较other是否为空。这样效率高
		   return true;
		}
		if(other == null){        
		   return false;
		}
		if(!(other instanceof TaskGroup)){
		   return false;
		}
		final TaskGroup g = (TaskGroup)other;
		if(!this.getGroupName().equals(g.getGroupName())){
			return false;
		}
		return true;
	}

	@Override
	public int hashCode() {
		return this.getGroupName().hashCode();
	}

	protected boolean isTimeout(){
		return this.startTime<=0?false:(System.currentTimeMillis()-this.startTime>this.timeout);
	}
	
	
	
	
	public String getGroupName() {
		return groupName;
	}
	public long getStartTime() {
		return startTime;
	}
	public long getTimeout() {
		return timeout;
	}
	protected void setStartTime(long startTime) {
		this.startTime = startTime;
	}


	public String getFrom() {
		return from;
	}



	public String getTo() {
		return to;
	}



	public String getFlightDate() {
		return flightDate;
	}
	
	
	protected void setTimeout(long timeout) {
		this.timeout = timeout;
	}

	
	
	
	protected BlockingQueue<GradChannelEntity> getChannels() {
		return channels;
	}

	protected void setChannels(Collection<GradChannelEntity> channels){
		this.channels=new ArrayBlockingQueue<GradChannelEntity>(channels.size(),false,channels);
	}
	
	public static void main(String[] args) {
		TaskGroup tg1=new TaskGroup("PEKCAN20130909", "pek", "CAN", "20130909", 120);
		TaskGroup tg2=new TaskGroup("PEKCAN20130909", "pek", "CAN", "20130909", 120);
		System.out.println(tg1.equals(tg2));
		System.out.println(tg1.hashCode());
		System.out.println(tg2.hashCode());
	}
	
	
*/}
